package com.qf.qfleadnewsmodel.article.vos;

import com.qf.qfleadnewsmodel.article.pojos.ApArticle;
import lombok.Data;

@Data
public class ApArticleVo extends ApArticle implements Comparable<ApArticleVo>{

    /**
     * 当前新闻的热度分数
     */
    private double score;

    @Override
    public int compareTo(ApArticleVo o) {
        int result = (int) (this.score - o.score);

        if (result == 0){
            result = (int) (this.getPublishTime().getTime() - o.getPublishTime().getTime());
        }

        if(result == 0){
            result = 1;
        }

        return result*(-1);
    }
}
